Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dargs

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dargs

Reverse minimist. Convert an object of options into an array of command-line arguments.

  • 5.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is dargs?

The dargs npm package is used to convert an object of options into an array of command-line arguments. This is particularly useful when you need to pass configuration options to a command-line tool in a programmatic way.

What are dargs's main functionalities?

Basic Conversion

Converts an object of options into an array of command-line arguments. In this example, the object { foo: 'bar', baz: true, qux: false } is converted to ['--foo', 'bar', '--baz'].

const dargs = require('dargs');
const options = { foo: 'bar', baz: true, qux: false };
const args = dargs(options);
console.log(args); // ['--foo', 'bar', '--baz']

Excluding Keys

Allows you to exclude specific keys from the conversion. In this example, the key 'qux' is excluded from the resulting array.

const dargs = require('dargs');
const options = { foo: 'bar', baz: true, qux: false };
const args = dargs(options, { excludes: ['qux'] });
console.log(args); // ['--foo', 'bar', '--baz']

Including Only Specific Keys

Allows you to include only specific keys in the conversion. In this example, only the keys 'foo' and 'baz' are included in the resulting array.

const dargs = require('dargs');
const options = { foo: 'bar', baz: true, qux: false };
const args = dargs(options, { includes: ['foo', 'baz'] });
console.log(args); // ['--foo', 'bar', '--baz']

Using Short Flags

Converts long flags to short flags if specified. In this example, the long flags are converted to short flags.

const dargs = require('dargs');
const options = { foo: 'bar', baz: true, qux: false };
const args = dargs(options, { shortFlag: true });
console.log(args); // ['-f', 'bar', '-b']

Other packages similar to dargs

Keywords

FAQs

Package last updated on 22 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc